package com.xc.一轮范例;

public class Student {

    String id;
    String name;
    double grade;
    boolean isOff;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getGrade() {
        return grade;
    }

    public void setGrade(double grade) {
        this.grade = grade;
    }

    public boolean isOff() {
        return isOff;
    }

    public void setOff(boolean off) {
        isOff = off;
    }


    @Override
    public String toString() {
        return "id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", grade=" + grade;
    }

    public static double update(Student student,double grade) {
        if ((grade%1)!=0) {
            System.out.println("修改失败");
            return student.grade;
        }
        if (grade>100) {
            System.out.println("修改失败");
            return student.grade;
        }
        student.setGrade(grade);
        return grade;
    }

    public boolean isPassed() {
        if (grade<60) {
            System.out.println("寄咯");
            return false;
        } else {
            System.out.println("过啦");
            return true;
        }
    }

    public static void unpassedList(Student[] students) {
        for (Student student : students) {
            if (student.isOff) {
                System.out.println(student.toString() + ": 退学");
            }
            if (!student.isPassed()) {
                System.out.println(student.toString() + ": 挂科");
            }
        }
    }


}
